#!/bin/bash

FFMPEG_SRC_DIR=../ffmpeg-3.2.1
X264_SRC_DIR=../x264-snapshot-20160627-2245
INSTALL_DIR=/home/xlb/work/media/test/third/ffmpeg

rm -rf $INSTALL_DIR

cd $X264_SRC_DIR
make clean
rm -rf x264_config.h
./configure --prefix=$INSTALL_DIR --enable-shared --enable-pic --disable-cli
make
make install

cd $FFMPEG_SRC_DIR
make clean
rm -rf config.h

./configure --prefix=$INSTALL_DIR \
--enable-gpl --enable-nonfree --enable-version3 --enable-small \
--enable-shared --disable-static \
--disable-doc --disable-programs --disable-debug --disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-ffserver \
--disable-postproc --disable-avdevice  --disable-avfilter  --disable-sdl --disable-zlib --disable-iconv \
--disable-everything \
--extra-cflags=-I$INSTALL_DIR/include --extra-ldflags=-L$INSTALL_DIR/lib --enable-libx264 --enable-encoder=libx264 \
--enable-decoder=h264 --enable-decoder=aac --enable-decoder=mjpeg --enable-encoder=aac \
--enable-muxer=mp4 --enable-muxer=h264 --enable-muxer=flv --enable-muxer=hls --enable-muxer=mov --enable-muxer=mjpeg --enable-muxer=image2 \
--enable-demuxer=mov --enable-demuxer=h264 --enable-demuxer=mpegts --enable-demuxer=flv --enable-demuxer=hls --enable-demuxer=image2 \
--enable-demuxer=image_jpeg_pipe --enable-demuxer=mjpeg --enable-demuxer=rtsp --enable-demuxer=rtp \
--enable-parser=aac --enable-parser=h264 \
--enable-bsf=aac_adtstoasc --enable-bsf=h264_mp4toannexb \
--enable-protocol=file --enable-protocol=hls --enable-protocol=http --enable-protocol=https \
--enable-protocol=rtp --enable-protocol=tcp --enable-protocol=udp --enable-protocol=rtmp
  
make  

make install  

rm -rf $INSTALL_DIR/include/x264.h
rm -rf $INSTALL_DIR/include/x264_config.h
rm -rf $INSTALL_DIR/lib/pkgconfig


